/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.cxhd.lis.ctrl;

import com.cxhd.lis.model.newmodel.lisKsdm;
import com.jfinal.aop.Before;
import com.jfinal.core.Controller;
import com.jfinal.ext.route.ControllerBind;
import com.jfinal.plugin.activerecord.Db;
import com.jfinal.plugin.activerecord.Page;
import com.jfinal.plugin.activerecord.Record;
import com.jfinal.plugin.activerecord.tx.Tx;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author 52461
 */
@ControllerBind(controllerKey = "/view/xmwh")
public class xmwhCtrl extends Controller{
    
    public void index(){
    
        render("/view/xmwh.jsp");
    }
     public void getTempList() {

         renderJson(Db.use("mysql").find("select id,pId,name,isParent,open from lis_ksmctemp"));
    }
     public void getKsmc() {
         renderJson(Db.use("mysql").findFirst("select id,KSDM,KSMC,FLKSDM,MJPB,JC,SRM1,HSKS,SRM2,SRM3,YJJE,ZLF,KFYKSSJ,ZJKSSJ from lis_ksdm where id="+getPara("id")));
    }
      public void getFlks() {
         renderJson(Db.use("mysql").find("select KSMC,KSDM from lis_ksdm "));
    }
      public void getKsdmId() {
         renderJson(Db.use("mysql").findFirst("select id FROM lis_ksdm where KSDM="+getPara("ksdm")));
    }
      public void getCheck() {
         Record re=Db.use("mysql").findFirst("select KSDM from lis_ksdm where KSDM="+getPara("ksdm"));
         if(re!=null){
             renderText("true");
         }else{
             renderText("false");
         }
    }
      public void saveKsdm(){
        try {
            new lisKsdm().addKsdm(this);
            renderText("true");
        } catch (Exception e) {
            e.printStackTrace();
            renderText("false");
        }
      }
      
      public void deleteKsdm(){
        try {
           new lisKsdm().deleteKsdm(getParaToInt("id"));
          renderText("true");
        } catch (Exception ex) {
            ex.printStackTrace();
            renderText("false");
            
        }
      }
   
}
